//including standard libraries
#include <stdlib.h>
#include <stdio.h>
//including function file
#include "functions.h"
//including japi functions
#include "japi.h"

//main function
int main(int argc, char *argv[])
{
    //declaring variables
    int i,*array_pointer;
    int no_of_crossovers;
    int check_value;
    //char argv[6];

    //argv = {no.txt};

    //checking if more than 1 argument has been passed to main
    if(argc>1)
    {
        //getting the arguments passed and displaying on screen
        for(i=0;i<argc;i++)
        {
            printf("\nInput file %d: %s\n", i, argv[i]);
        }
    }
    //if no additional command line arguments are passed
    else
    {
        //function call for gui
        gui();
        //printf("\nNo additional input file passed for %s\n", argv[0]);
    }

    //function call to load file
    array_pointer = load_file_function(argv[1]);
    //function call to the crossover count function
    no_of_crossovers = get_zero(array_pointer[1],array_pointer[0]);
    printf("%d\n", no_of_crossovers);
    //function call to the check function
    check_value = check_file_type(no_of_crossovers);

    //if statement if it's a no file
    if(check_value==0)
    {
        //display message
        printf("The file entered is a sample of the word 'no'.\n\n");
    }
    //else statement if it's a yes file
    else if(check_value==1)
    {
        //display message
        printf("The file entered is a sample of the word 'yes'.\n\n");
    }
    else if(check_value==2)
    {
        //display message if the file is not valid
        printf("The file entered is silence\n\n");
    }

    else
    {
        //display message if the file is not valid
        printf("The sample value is not recognizable\n\n");
    }

}


